package com.itheima.sh.clients;

import com.itheima.sh.clients.fallback.UserFeignApiFallBack;
import com.itheima.sh.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;


@Primary
@FeignClient(value = "user-service",fallback = UserFeignApiFallBack.class) // 服务名称是从 Eureka server中获取
//@FeignClient("user-service")  // 服务名称是从 Eureka server中获取
public interface UserFeignApi {

    @GetMapping("/{id}")
    public User queryById(@PathVariable("id") String username);
}
